<?php
class Api extends  Controller
{
    function Api()
    {
        parent::Controller();
      
		header("Content-Type: text/html; charset=utf-8");
		
    }
    
    function getcompany()
    {
    	$areaid = $_POST["areaid"];
    	if($areaid>0)
    	{
    		$query = $this->db->query("select companyid,company from ".table("company")." where areaid=".$areaid);
    		$rs = $query->result();
    		if(is_array($rs))
    		{
    			
    			echo json_encode($rs);
    		}
    		
    	}
    	
    }
    function geteatfood()
    {
    	$areaid = 1;
    	$eatid = $_POST["eatid"];
    	$eat = geteatinfo($this->db,$eatid);
    		
		$foodlist = getfoodlist($this->db,$eatid);
		
		$result = array("error"=>0,"result"=>"");
		if(count($foodlist)>0)
		{
			
			$this->tp->assign("foodlist",$foodlist);
			$this->tp->assign("eat",$eat);
		    $content = $this->tp->fetch("orders_ajax.htm");
			$result = array("error"=>1,"result"=>$content);
		}
		echo json_encode($result);
    }
    
    
    
}    
?>